#!/usr/bin/env python
# -*- coding: utf-8 -*-
#  education_feed_helper.py
#  description

#  Created by zhouzongli633 on 2020/8/17 1:12 下午.
#  Copyright ©Intellectus All rights reserved.
from Baby.models import Users
from EducationContent.models import EducationFeeds
from User import user_helper


def content_for(user_id, opts=None):
    if opts is None:
        opts = {}
    all_users = user_helper.get_all_family_members(user_id)
    if opts and 'recommended_content' in opts and opts['recommended_content']:
        pass


def card_data(feed, user_id, all_users):
    try:
        json = {'id': feed.id, 'card_title': feed.title, 'source': feed.source}
        if feed.summary_1 and feed.summary_2:
            card_description = '<ul style="margin: 0; padding: 0; list-style-position: inside; font-family: \'Helvetica ' \
                               'Neue\'; font-size: 17px;"> '
            card_description += '<li style="margin: 0; padding: 0; list-style-position: inside;">' + feed.summary_1 + '</li>'
            card_description += '<li style="margin: 0; padding: 0; list-style-position: inside;">' + feed.summary_2 + '</li>'
            card_description += '</ul>'
            json['card_description'] = card_description
        elif feed.summary_1:
            card_description = '<p style="font-family: \'Helvetica Neue\'; font-size: 17px;">'
            card_description += '<span style="">' + feed.summary_1 + '</span>'
            card_description += '</p>'
            json['card_description'] = card_description
        elif feed.summary_2:
            card_description = '<p style="font-family: \'Helvetica Neue\'; font-size: 17px;">'
            card_description += '<span style="">' + feed.summary_2 + '</span>'
            card_description += '</p>'
            json['card_description'] = card_description

    except Exception as e:
        raise e
